<template>
	<div>
		<el-row :gutter="20">
			<el-col :span="24">
				<el-table :data="tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)" height="520">
					<el-table-column prop="staffId" label="序号" width="100" sortable align="center" />
					<el-table-column prop="staffName" label="姓名" width="120" sortable align="center" />
					<el-table-column prop="staffDepartment" label="部门" width="120" align="center" />
					<el-table-column prop="staffJob" label="职位" width="160" sortable align="center" />
					<el-table-column prop="staffGender" label="性别" width="100" sortable align="center" />
					<el-table-column prop="staffJobnumber" label="工号" width="150" sortable align="center" />
					<el-table-column prop="staffEducation" label="学历" width="120" sortable align="center" />
					<el-table-column prop="staffDegree" label="学位" width="200" sortable align="center" />
					<el-table-column prop="staffPhone" label="手机号码" width="200" sortable align="center" />
				</el-table>
			</el-col> </el-row><br />
		<el-pagination
			@size-change="handleSizeChange"
			@current-change="handleCurrentChange"
			:current-page="currentPage"
			:page-sizes="[5, 10, 20, 30]"
			:page-size="10"
			layout="total, sizes, prev, pager, next, jumper"
			:total="tableData.length"
		></el-pagination>
	</div>
</template>
<script>
import axios from 'axios';
export default {
	name: '',
	data() {
		return {
			tableData: '',
			currentPage: 1, // 当前页码
			total: 30, // 总条数
			pageSize: 10, // 每页的数据条数
		};
	},
	mounted: function () {
		this.searchWeather();
	},
	methods: {
		searchWeather() {
			var that = this;
			axios
				.get('http://121.41.117.22:8081/staff-archives/findAll')
				.then(function (response) {
					//console.log(response.data);
					that.tableData = response.data;
				})
				.catch(function (err) {});
		},
		handleEdit(index, row) {
			console.log(index, row);
		},
		handleDelete(index, row) {
			console.log(index, row);
		},
		handleSizeChange(val) {
			console.log(`每页 ${val} 条`);
			this.currentPage = 1;
			this.pageSize = val;
		},
		handleCurrentChange(val) {
			console.log(`当前页: ${val}`);
			this.currentPage = val;
		},
		deleteRow(index, rows) {
			rows.splice(index, 1);
		},
	},
};
</script>
<style lang="scss" scoped>
</style>